package com.cam.generator.mapStruct;

import com.cam.generator.dto.GenCodeFieldDTO;
import com.cam.generator.entity.GenCodeField;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface GenCodeFieldMapStruct {

    @Mappings({
            @Mapping(source = "genId", target = "genCode.id"),
            @Mapping(source = "createBy", target = "createBy.id"),
            @Mapping(source = "updateBy", target = "updateBy.id")
    })
    GenCodeFieldDTO toDTO(GenCodeField genCodeField);

    @Mappings({
            @Mapping(source = "genCode.id", target = "genId"),
            @Mapping(source = "createBy.id", target = "createBy"),
            @Mapping(source = "updateBy.id", target = "updateBy")
    })
    GenCodeField toEntity(GenCodeFieldDTO genCodeFieldDTO);
}
